Axes Rotation: Point Rotation

Axes Rotation.png
Figure 1: Axes Rotation. Point P has coordinates $(x,y)$ in the original axes and it has coordinates $(x',y')$ in the rotated axes. We have rotated about the origin, but only rotated the axes, not the point $P$.

Imagine point $P(x,y)$ in the $xy$ plane, with coordinates $P=(x,y)$. The axes for $P$ are the usual $x$ and $y$ axis. Now imagine that we want to leave $P$ exactly where it was in space, but to rotate the axes to a new set which we will call $(x',y')$. Let's let $\theta$ be the angle from the original $x$ axis to the new $x'$ axis, and let's let $\alpha$ be the angle from the new $x'$ axis to the point $P$. See figure 1.

Using polar coordinates, $P=(r,\alpha+\theta)$. Based on the original coordinates, and the angles as labelled in figure 1, $$P=\left(\begin{array}{c} x\\ y \end{array}\right)=\left(\begin{array}{c} r\cdot\cos(\alpha+\theta)\\ r\cdot\sin(\alpha+\theta) \end{array}\right). \tag*{$\class{red}{(1)}$} \label{1}$$ While in the newly rotated system, $$P=\left(\begin{array}{c} x'\\ y' \end{array}\right)=\left(\begin{array}{c} r\cdot\cos(\alpha)\\ r\cdot\sin(\alpha) \end{array}\right) \tag*{$\class{red}{(2)}$} \label{2}$$ Starting with equation $\ref{1}$ and using a standard trig identity, $$x=r\cdot\cos(\alpha+\theta)$$ $$x=r\left[\cos\alpha\,\cos\theta-\sin\alpha\,\sin\theta\right]$$ $$x=r\cdot\cos\alpha\,\cos\theta-r\cdot\sin\alpha\,\sin\theta$$ but, based on equation $\ref{2}$, $x'=r\cdot\cos\alpha$ and $y'=r\cdot\sin\alpha$, so substitute and $$x=x'\cos\theta-y'\sin\theta.$$ By similar algebra, $$y=r\cdot\sin(\alpha+\theta)$$ $$y=r\left[\sin\alpha\,\cos\theta+\sin\theta\,\cos\alpha\right]$$ $$y=r\cdot\cos\alpha\,\sin\theta+r\cdot\sin\alpha\,\cos\theta$$ $$y=x'\sin\theta+y'\cos\theta$$ Putting this all together, $$\left(\begin{array}{c} x\\ y \end{array}\right)=\left(\begin{array}{c} x'\cos\theta-y'\sin\theta\\ x'\sin\theta+y'\cos\theta \end{array}\right). \tag*{$\class{red}{(3)}$} \label{3}$$ Using matrix notation, this can become, $$\left(\begin{array}{c} x\\ y \end{array}\right)=\left(\begin{array}{cc} \cos\theta & -\sin\theta\\ \sin\theta & \cos\theta \end{array}\right)\left(\begin{array}{c} x'\\ y' \end{array}\right) \tag*{$\class{red}{(4)}$} \label{4}$$ This process shows how to take an $(x',y')$ coordinate back to $(x,y)$. To go the other way, we have two choices. One choice is to simply change the sign of $\theta$. The other is to do some algebra and solve for $x'$ and $y'$.

From equation $\ref{3}$, isolate $x'$ from the top row and substitute it into the bottom row. $$x'\cos\theta=x+y'\sin\theta$$ $$x'=\frac{x}{\cos\theta}+\frac{y'\sin\theta}{\cos\theta}$$ Now substitute into the bottom of $\ref{3}$. $$\begin{aligned} \\y&=\left(\frac{x}{\cos\theta}+\frac{y'\sin\theta}{\cos\theta}\right)\cdot\sin\theta+y'\cos\theta \\y&=x\frac{\sin\theta}{\cos\theta}+\frac{y'\sin^{2}\theta}{\cos\theta}+y'\cos\theta \\y\cdot\cos\theta&=x\sin\theta+y'\sin^{2}\theta+y'\cos^{2}\theta \\y\cos\theta&=x\sin\theta+y' \\y'&=-x\sin\theta+y\cos\theta \end{aligned}$$ Similarly, we can begin with the bottom row of $\ref{3}$ and substitute into the top of $\ref{3}$. $$\begin{aligned} y'\cos\theta&=y-x'\sin\theta \\y'&=\frac{y}{\cos\theta}-\frac{x'\sin\theta}{\cos\theta} \end{aligned}$$ Now substitute into the top of $\ref{3}$. $$\begin{aligned} x&=x'\cos\theta-\left(\frac{y}{\cos\theta}-\frac{x'\sin\theta}{\cos\theta}\right)\sin\theta \\x&=x'\cos\theta-y\frac{\sin\theta}{\cos\theta}+\frac{x'\sin^{2}\theta}{\cos\theta} \\x\cos\theta&=x'\cos^{2}\theta-y\sin\theta+x'\sin^{2}\theta \\x\cos\theta&=x'\left(\cos^{2}x+\sin^{2}\theta\right)-y\sin\theta \\x'&=x\cos\theta-y\sin\theta \end{aligned}$$ We see that, except for clock or counter clock rotation, it doesn't matter whether we start with $(x',y')$ or $(x.y)$. The counter clock rotation matrix is given in $\ref{4}$ and the clockwise rotation is given in $\ref{5}$. $$\left(\begin{array}{c} x'\\ y' \end{array}\right)=\left(\begin{array}{cc} \cos\theta & \sin\theta\\ -\sin\theta & \cos\theta \end{array}\right)\left(\begin{array}{c} x\\ y \end{array}\right). \tag*{$\class{red}{(5)}$} \label{5}$$

Equation Rotation

When we are just rotating a point, as $A=\left(\begin{array}{c}A_{x}\\A_{y}\end{array}\right)$, then $\ref{4}$ is the math to go counter-clockwise. We are staying in the $(x,y)$ reference frame. However, if we want to rotate an equation and graph it in our $(x,y)$ reference frame, then we have to substitute into the equation the computed values for $(x',y')$. That means that to rotate an equation counter-clockwise, we substitute in $$\left(\begin{array}{c} x'\\ y' \end{array}\right)=\left(\begin{array}{c} x\cos\theta+y\sin\theta\\ -x\sin\theta+y\cos\theta \end{array}\right) \tag*{$\class{red}{[6]}$} \label{6}$$ and then do the algebra to get the new equation.

Aside: When we rotate an equation using $\ref{6}$, we are always rotating about the origin. That is why you may frequently read that something needs to be translated to the origin, rotated, and then translated back to where it was. That would allow you to rotate about any given point in the plane.
RotatingEquations.png
Figure 2: In the left panel, we started with equation $y=2x+3$ and applied the substitutions of equation $\ref{6}$ to go $90^{\circ}$ counter clockwise around to $2y+x=-3$. Similarly in the right panel we applied the substitutions of \ref{6} to go around $90^{\circ}$.

Sometimes this is way less than obvious and I want to do an ultra simple example.

Example: Given the linear equation $y=2x+3$, rotate it counter-clockwise by $90^{\circ}$.
Answer: The first thing is to put the equation into general form. $$2x-y=-3 \tag*{$\class{red}{[7]}$} \label{7}$$ Next substitute into $\ref{7}$ $x'$ and $y'$ for $x$ and $y$. $$2x'-y'=-3$$ Now change $x'$ and $y'$ to have their values as seen in $\ref{6}$. $$2\left(x\cos\theta+y\sin\theta\right)-\left(-x\sin\theta+y\cos\theta\right)=-3$$ $\theta$ is $90^{\circ}$ which is $\pi/2$ so make that substitution too. $$2\left(x\cos\left(\frac{\pi}{2}\right)+y\sin\left(\frac{\pi}{2}\right)\right)-\left(-x\sin\left(\frac{\pi}{2}\right)+y\cos\left(\frac{\pi}{2}\right)\right)=-3$$ The $\cos\left(\frac{\pi}{2}\right)=0$ and the $\sin\left(\frac{\pi}{2}\right)=1$ so we can simplify to $$2\left(x\cdot0+y\cdot1\right)-\left(-x\cdot1+y\cdot0\right)=-3$$ $$2y+x=-3.$$
EqRotate45.png
Figure 3: The vertical parabola has been rotated counter-clockwise by $45^{\circ}$ using Eq $\ref{6}$ to make substitutions. The rotated equation had to be graphed implicitely.
Example: Rotate the parabola $y=4x^2-2x$ counter-clockwise by $\pi/4$ rads.
Answer: Begin by putting the equation in standard form: $4x^{2}-2x-y=0$. Next we will substitute values for $x'$ and $y'$ in place of $x$ and $y$ in the equation. $$\left(\begin{array}{c} x'\\ y' \end{array}\right)=\left(\begin{array}{c} x\,\cos\left(\frac{\pi}{4}\right)+y\,\sin\left(\frac{\pi}{4}\right)\\ -x\,\sin\left(\frac{\pi}{4}\right)+y\,\cos\left(\frac{\pi}{4}\right) \end{array}\right)$$ Here is the substituted equation: $$4\left(x\,\cos\left(\frac{\pi}{4}\right)+y\,\sin\left(\frac{\pi}{4}\right)\right)^{2}-2\left(x\,\cos\left(\frac{\pi}{4}\right)+y\,\sin\left(\frac{\pi}{4}\right)\right)-\left(-x\,\sin\left(\frac{\pi}{4}\right)+y\,\cos\left(\frac{\pi}{4}\right)\right)=0.$$ This simplifies to $$2x^{2}+2y^{2}+4xy-\left(\frac{1}{2}\sqrt{2}\right)x-\left(\frac{3}{2}\sqrt{2}\right)y=0.$$